package java8.test;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

public class PrintUtil {
    private static final ObjectMapper om = new ObjectMapper();

    public static void print(Object object) {
        String result;
        try {
            long l = System.currentTimeMillis();
            //result = om.writerWithDefaultPrettyPrinter().writeValueAsString(object);
            result = om.writeValueAsString(object);
            System.out.println("转换用时：" + (System.currentTimeMillis() - l));
            System.out.println(result);
            System.out.println("============");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
